from llama_index.core import SimpleDirectoryReader, VectorStoreIndex, Settings

from config.embeddings import embed_model_local_bge_small
from config.llm import deepseek_llm

# 加载指定目录下的文件
documents = SimpleDirectoryReader('../data').load_data()

print("doucments:", documents)

# 设置LLM和Embedding模型
Settings.llm = deepseek_llm()
Settings.embed_model = embed_model_local_bge_small()

# 构建向量索引
vector_index = VectorStoreIndex.from_documents(documents)
query_engine = vector_index.as_query_engine()
response = query_engine.query("员工的年假有几天？")
print(response)